home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Bombardier_PC
/
DATACH.CST
/
00054_Script_54
< prev
next >
Wrap
Text File
|
1999-03-07
|
12KB
|
296 lines
--
-- clear database fields in cast starting at startingcast
-- ond ending when a castmember called "***end***" is reached
on eraseDataBaseFields startingcast
global competestate
set currentDBcast = startingcast
set the floatPrecision = 2
repeat while true
set findname = the name of member currentDBcast
if findname = "***end***" then
exit repeat
else
set the text of member currentDBcast = " "
end if
set currentDBcast = currentDBcast + 1
end repeat
end
-- junkdatabasefields
-- startingcast = castnum to start at
-- fillstring = value to set fields to
on junkDataBaseFields startingcast, fillstring
global competestate
set currentDBcast = startingcast
set the floatPrecision = 2
repeat while true
set findname = the name of member currentDBcast
if findname = "***end***" then
exit repeat
else
if findname = "tFuel" then
set the text of member currentDBcast = fillstring
else
set the text of member currentDBcast = " "
end if
end if
set currentDBcast = currentDBcast + 1
end repeat
end
-- getfieldvalue gets the value of field called fieldnametofind starting at startingcast
-- returns that fields value
--
on getfieldvalue startingcast, fieldnametofind
set currentDBcast = startingcast
repeat while true
set findname = the name of member currentDBcast
if findname = "***end***" then
exit repeat
else
if findname = fieldnametofind then
set outvalue = the text of member currentDBcast
end if
end if
set currentDBcast = currentDBcast + 1
end repeat
return outvalue
end
-- setfieldvalue
-- finds a field named fieldnametofind
-- by searching through the cast starting at startingcast.
-- when the field is found it's text is changed to newfieldvalue.
on setfieldvalue startingcast, fieldnametofind, newfieldvalue
set currentDBcast = startingcast
repeat while true
set findname = the name of member currentDBcast
if findname = "***end***" then
exit repeat
else
if findname = fieldnametofind then
set the text of member currentDBcast = newfieldvalue
end if
end if
set currentDBcast = currentDBcast + 1
end repeat
return outvalue
end
-- fill data for annual cost screen (main plane)
on getannualcostsmain
global currentplane
global llairprice, llresidual, lldepreciation, lllease, llnadirect
global llnafixed, lledirect, llefixed, llnabudget, llebudget, llemult
global allairprice, allresidual, alldepreciation, alllease, allnadirect
global allnafixed, alledirect, allefixed, allnabudget, allebudget
watchcursor()
set llnadirect = value(losemoney(the text of field "aabartotal"))
getannualcosts(currentplane)
set allairprice = llairprice
set allresidual = llresidual
set alldepreciation = lldepreciation
set alllease = lllease
set allnadirect = llnadirect
set allnafixed = llnafixed
-- set alledirect = lledirect
-- set allefixed = llefixed
set allnabudget = llnabudget
set allebudget = llebudget
set the text of field "lairprice" = "$ "&formatch(llairprice)
set the text of field "lresidual" = "$ "&formatch(llresidual)
set the text of field "ldepreciation" = "$ "&formatch(lldepreciation)
set the text of field "llease" = "$ "&formatch(lllease)
set the text of field "lnadirect" = "$ "&formatch(llnadirect)
set the text of field "lnafixed" = "$ "&formatch(llnafixed)
-- set the text of field "ledirect" = "$ "&formatch(lledirect)
-- set the text of field "lefixed" = "$ "&formatch(llefixed)
set the text of field "lnabudget" = "$ "&formatch(llnabudget)
-- set the text of field "lebudget" = "$ "&formatch(llebudget)
set cplane = the text of field "acplanename"
if (length(cplane) > 2) and (cplane<>"No Competitor") then
getannualcostscomp
-- compareannualcosts
end if
arrowcursor()
end
-- fill data for annual cost screen (competitor)
on getannualcostscomp
global currentplane
global llairprice, llresidual, lldepreciation, lllease, llnadirect
global llnafixed, lledirect, llefixed, llnabudget, llebudget, llemult
global cllairprice, cllresidual, clldepreciation, clllease, cllnadirect
global cllnafixed, clledirect, cllefixed, cllnabudget, cllebudget
watchcursor()
set llnadirect = value(losemoney(the text of field "acbartotal"))
getannualcosts(the text of field "acplanename")
set cllairprice = llairprice
set cllresidual = llresidual
set clldepreciation = lldepreciation
set clllease = lllease
set cllnadirect = llnadirect
set cllnafixed = llnafixed
set clledirect = lledirect
set cllefixed = llefixed
set cllnabudget = llnabudget
set cllebudget = llebudget
set the text of field "lcairprice" = "$ "&formatch(llairprice)
set the text of field "lcresidual" = "$ "&formatch(llresidual)
set the text of field "lcdepreciation" = "$ "&formatch(lldepreciation)
set the text of field "lclease" = "$ "&formatch(lllease)
set the text of field "lcnadirect" = "$ "&formatch(llnadirect)
set the text of field "lcnafixed" = "$ "&formatch(llnafixed)
-- set the text of field "lcedirect" = "$ "&formatch(lledirect)
-- set the text of field "lcefixed" = "$ "&formatch(llefixed)
set the text of field "lcnabudget" = "$ "&formatch(llnabudget)
-- set the text of field "lcebudget" = "$ "&formatch(llebudget)
compareannualcosts
arrowcursor()
end
-- displays negative numbers as "(87)" instead of "-87"
on fixnegnums instrx1, instrx2
set ssx1 = value(instrx1)
set ssx2 = value(instrx2)
set ssx = (ssx1 - ssx2)
if ssx < 0 then
set outstrx = "($ "&string(formatch(0-ssx))&")"
else set outstrx = "$ "&string(formatch(ssx))
return outstrx
end
-- fill comparison fields in annual cost screen
on compareannualcosts
global cllairprice, cllresidual, clldepreciation, clllease, cllnadirect
global cllnafixed, clledirect, cllefixed, cllnabudget, cllebudget
global allairprice, allresidual, alldepreciation, alllease, allnadirect
global allnafixed, alledirect, allefixed, allnabudget, allebudget
set the text of field "ldairprice" = fixnegnums(allairprice, cllairprice)
set the text of field "ldresidual" = fixnegnums(allresidual, cllresidual)
set the text of field "lddepreciation" = fixnegnums(alldepreciation,clldepreciation)
set the text of field "ldlease" = fixnegnums(alllease, clllease)
set the text of field "ldnadirect" = fixnegnums(allnadirect, cllnadirect)
set the text of field "ldnafixed" = fixnegnums(allnafixed,cllnafixed)
set the text of field "ldedirect" = fixnegnums(alledirect, clledirect)
set the text of field "ldefixed" = fixnegnums(allefixed, cllefixed)
set the text of field "ldnabudget" = fixnegnums(allnabudget, cllnabudget)
set the text of field "ldebudget" = fixnegnums(allebudget, cllebudget)
end
on DGRSGetFieldValuech fieldname,handlefordb
-- put fieldname
set iout = DGRSGetFieldValue(fieldname,handlefordb)
if iout = "#ERROR#" then
alert fieldname & " not found"
else
-- put fieldname & "=" & iout
end if
return iout
end
-- get data for annual costs
on getannualcosts dataplane
global llairprice, llresidual, lldepreciation, lllease, llnadirect
global llnafixed, lledirect, llefixed, llnabudget, llebudget, llemult
global DBRECORD, DBHANDLE
-- read data directly from tables into global variables
-- and calculate as needed
set DBRECORD = DGcreateRecordset("SELECT * FROM Table1price", DBHANDLE)
set chquery = "Aircraft = " & QUOTE & dataplane & QUOTE
set outresult =DGRSfindFirst(chquery, DBRECORD)
-- put dataplanename & " - "outresult & "= out"
if outresult<> 0 then
set llairprice = value(DGRSGetFieldValuech("price completed",DBRECORD))
set llresidual = value(DGRSGetFieldValuech("Residual value",DBRECORD))
set lldepreciation = value(llairprice) - value(llresidual)
set lllease = value(DGRSGetFieldValuech("Annual Lease",DBRECORD))
else
alert("table1price not found-"&dataplane)
end if
if DBRECORD > 0 then
if DGRSIsOpen(DBRECORD) then
DGRSClose(DBRECORD)
end if
end if
set DBRECORD = DGcreateRecordset("SELECT * FROM cost_per_hours", DBHANDLE)
set chquery = "Aircraft = " & QUOTE & dataplane & QUOTE
set outresult =DGRSfindFirst(chquery, DBRECORD)
-- put dataplanename & " - "outresult & "= out"
if outresult<> 0 then
set cchours = value(DGRSGetFieldValuech("hours",DBRECORD))
set llemult = cchours
-- put "direct="&llnadirect&", mult="&llemult
set llnadirect = llnadirect * llemult
else
alert("costperhours not found-"&dataplane)
end if
if DBRECORD > 0 then
if DGRSIsOpen(DBRECORD) then
DGRSClose(DBRECORD)
end if
end if
-- set nadirect
set DBRECORD = DGcreateRecordset("SELECT * FROM cost_per_region", DBHANDLE)
set chquery = "Aircraft = " & QUOTE & dataplane & QUOTE
set outresult =DGRSfindFirst(chquery, DBRECORD)
-- put dataplanename & " - "outresult & "= out"
if outresult<> 0 then
set cxx = integer(value(DGRSGetFieldValuech("captain salary",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("co pilot salary",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("benefits",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("hangar",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("computerized Maintenance",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("Navigation Chart Services",DBRECORD)))
set cxx = cxx + integer(value(DGRSGetFieldValuech("Weather Services",DBRECORD)))
set xcc = integer(value(DGRSGetFieldValuech("aircraft hull insurance",DBRECORD)))
set xcc = xcc + integer(value(DGRSGetFieldValuech("Legal Liability",DBRECORD)))
set xcc = xcc + integer(value(DGRSGetFieldValuech("Admitted Liability",DBRECORD)))
set xcc = xcc + integer(value(DGRSGetFieldValuech("Training (transport)",DBRECORD)))
set xcc = xcc + integer(value(DGRSGetFieldValuech("Interior Reserve",DBRECORD)))
set xcc = xcc + integer(value(DGRSGetFieldValuech("Aircraft Modernization",DBRECORD)))
else
-- alert("costperregion not found-"&dataplane)
NOTHING
end if
set llnafixed = (cxx + (xcc))
set outresult =DGRSfindNext(chquery, DBRECORD)
-- put dataplanename & " - "outresult & "= out"
if outresult<> 0 then
set cxx = value(DGRSGetFieldValue("captain salary",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("co pilot salary",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("benefits",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("hangar",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("computerized Maintenance",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("Navigation Chart Services",DBRECORD))
set cxx = cxx + value(DGRSGetFieldValuech("Weather Services",DBRECORD))
set xcc = value(DGRSGetFieldValuech("aircraft hull insurance",DBRECORD))
set xcc = xcc + value(DGRSGetFieldValuech("Legal Liability",DBRECORD))
set xcc = xcc + value(DGRSGetFieldValuech("Admitted Liability",DBRECORD))
set xcc = xcc + value(DGRSGetFieldValuech("Training(transport)",DBRECORD))
set xcc = xcc + value(DGRSGetFieldValuech("Interior Reserve",DBRECORD))
set xcc = xcc + value(DGRSGetFieldValuech("Aircraft Modernization",DBRECORD))
else
-- alert("costperregion2 not found-"&dataplane)
end if
set llefixed = (cxx + (xcc))
if DBRECORD > 0 then
if DGRSIsOpen(DBRECORD) then
DGRSClose(DBRECORD)
end if
end if
set llnabudget = (lllease + llnadirect + llnafixed)
set llebudget = (lllease + lledirect + llefixed)
-- put "na"&&lllease&&llnadirect&&llnafixed&&llnabudget
end